package com.jy.wms.controller;

import com.github.pagehelper.Page;
import com.jy.wms.common.base.BaseController;
import com.jy.wms.common.base.ResultPage;
import com.jy.wms.common.base.ServiceException;
import com.jy.wms.pojo.WmsPdaReplenishment;
import com.jy.wms.service.WmsPdaReplenishmentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import net.sf.json.JSONObject;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpSession;
import java.util.Map;

/**
 * @ClassName: WmsPdaReplenishmentController
 * @Description: TODO(这里用一句话描述这个类的作用)
 * @Author LH
 * @Date Tue Jan 30 18:06:43 GMT+08:00 2018
 */
@RestController
@RequestMapping("/wmspdareplenishment")
@Api(value = "/wmspdareplenishment", description = "关于下发补货任务操作")
public class  WmsPdaReplenishmentController extends BaseController<WmsPdaReplenishmentService,WmsPdaReplenishment> {




    @PostMapping(value = "/list")
    @ApiOperation(value = "查询信息", response = JSONObject.class, notes = "查询信息")
    public @ResponseBody
    ResultPage<WmsPdaReplenishment> getWmsPdaReplenishment(@RequestBody Map map, HttpSession session) {
        Page<WmsPdaReplenishment> list =null;
        try {
            list=baseService.getPdaReplement((String) map.get("bhid"), (String) map.get("bhlx"), (Integer) map.get("page"), (Integer) map.get("rows"));
        } catch (ServiceException e) {
            e.printStackTrace();
        }
        return renderPage(list);
    }

  /*  @PostMapping(value = "delete")
    @ApiOperation(value = "删除信息",response = JSONObject.class, notes = "删除信息")
    public @ResponseBody JsonResult deleteWmsPdaReplenishment(@RequestBody List<String> ids) {
        Integer flag=baseService.baseDeleteBathPrimaryKeys(ids);
        return renderSuccess("删除成功");
    }

    @PostMapping(value = "add")
    @ApiOperation(value = "新增信息",response = JSONObject.class, notes = "新增信息")
    public @ResponseBody JsonResult addWmsPdaReplenishment(@RequestBody WmsPdaReplenishment entity) {
        entity.setId(UUIDUtils.uuid());
        baseService.baseInsert(entity);
        return renderSuccess("添加成功");
    }

    @GetMapping(value = "getWmsPdaReplenishment/{id}")
    @ApiOperation(value = "查看单个信息",response = JSONObject.class, notes = "GET查看单个信息")
    public @ResponseBody WmsPdaReplenishment getWmsPdaReplenishmentById(@PathVariable("id") String id) {
        WmsPdaReplenishment entity=baseService.baseSelectByPrimaryKey(id);
        return entity;
    }
    @PostMapping(value = "edit")
    @ApiOperation(value = "编辑信息",response = JSONObject.class, notes = "编辑信息")
    public @ResponseBody JsonResult editWmsPdaReplenishment(@RequestBody WmsPdaReplenishment entity) {
        Integer flag=baseService.baseUpdateByPrimaryKeySelective(entity);
        return renderSuccess("修改成功");
    }*/
}
